import request from '@/config/axios'

// 电表 VO
export interface ElectricityMeterVO {
  id: number // id
  houseId: number // 农舍
  deviceId: string // 设备编号
  name: string // 设备名称
  description: string // 描述
  status: number // 状态
}

// 电表 API
export const ElectricityMeterApi = {
  // 查询电表分页
  getElectricityMeterPage: async (params: any) => {
    return await request.get({ url: `/farm/electricity-meter/page`, params })
  },

  // 查询电表详情
  getElectricityMeter: async (id: number) => {
    return await request.get({ url: `/farm/electricity-meter/get?id=` + id })
  },

  // 新增电表
  createElectricityMeter: async (data: ElectricityMeterVO) => {
    return await request.post({ url: `/farm/electricity-meter/create`, data })
  },

  // 修改电表
  updateElectricityMeter: async (data: ElectricityMeterVO) => {
    return await request.put({ url: `/farm/electricity-meter/update`, data })
  },

  // 删除电表
  deleteElectricityMeter: async (id: number) => {
    return await request.delete({ url: `/farm/electricity-meter/delete?id=` + id })
  },

  // 导出电表 Excel
  exportElectricityMeter: async (params) => {
    return await request.download({ url: `/farm/electricity-meter/export-excel`, params })
  },
  // 农舍精简列表
  getSimpleHouseApi:async ()=>{
    return await request.get({
      url:`/farm/house/list-all-simple`,
    })
  },
}
